package org.example.Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:Lenovo
 * Date:2022-03-22
 * Time:14:42
 */
public class Demo12 {
    public static void main(String[] args) {
        java.lang.Thread t = new java.lang.Thread(() ->{
            for (int i = 0; i < 10; i++) {
                System.out.println("hello thread");
                try {
                    java.lang.Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t.start();

        try {
            t.join(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("等不及了，不等了");
    }
}
